﻿using HelperFromTheSkeleton.Model.DomainModels;

namespace HelperFromTheSkeleton.EFBaseRepository
{
    public interface IBaseUnitWork
    {
        /// <summary>
        /// 新增数据
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void Add<T>(T entity) where T : BaseDomain;

        /// <summary>
        /// 更新
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void Updata<T>(T entity) where T : BaseDomain;

        /// <summary>
        /// 删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void Delete<T>(T entity) where T : BaseDomain;

        /// <summary>
        /// 软删除
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="entity"></param>
        void SoftDelete<T>(T entity) where T : BaseDomain;

        /// <summary>
        /// 提交数据
        /// </summary>
        /// <returns></returns>
        Task CommitAsync();
    }
}
